package request

import (
	"gin_server/internal/model" // 请替换为实际的包路径
)

// GroupCreateRequest 用于创建群组的请求结构体
type GroupCreateRequest struct {
	GroupId        string                `json:"group_id" binding:"required,max=36" `                     // 群组uuid
	CreatorUid     int64                 `json:"creator_uid" binding:"required" `                         // 群组所属用户id
	GroupName      string                `json:"group_name" binding:"required,max=48" `                   // 群组名称
	GroupAvatar    string                `json:"group_avatar" binding:"required,max=120" `                // 群组头像
	GroupIntroduce *string               `json:"group_introduce" binding:"omitempty" `                    // 群组简介
	GroupStatus    model.GroupStatusType `json:"group_status" binding:"required,oneof=forbidden normal" ` // 群状态

}

// GroupUpdateRequest 用于更新群组的请求结构体
type GroupUpdateRequest struct {
	GroupId        *string                `json:"group_id" binding:"omitempty,max=36" `                     // 群组uuid
	CreatorUid     *int64                 `json:"creator_uid" binding:"omitempty" `                         // 群组所属用户id
	GroupName      *string                `json:"group_name" binding:"omitempty,max=48" `                   // 群组名称
	GroupAvatar    *string                `json:"group_avatar" binding:"omitempty,max=120" `                // 群组头像
	GroupIntroduce *string                `json:"group_introduce" binding:"omitempty" `                     // 群组简介
	GroupStatus    *model.GroupStatusType `json:"group_status" binding:"omitempty,oneof=forbidden normal" ` // 群状态

}

// GroupQueryRequest 用于查询群组的请求结构体
type GroupQueryRequest struct {
	Current     int                    `form:"current" binding:"required" default:"1"`
	PageSize    int                    `form:"pageSize" binding:"required" default:"10"`
	GroupId     *string                `form:"group_id" binding:"omitempty,max=36"`                     // 群组uuid
	CreatorUid  *int64                 `form:"creator_uid" binding:"omitempty"`                         // 群组所属用户id
	GroupName   *string                `form:"group_name" binding:"omitempty,max=48"`                   // 群组名称
	GroupStatus *model.GroupStatusType `form:"group_status" binding:"omitempty,oneof=forbidden normal"` // 群状态

}

// ToModel 将请求结构体转换为模型结构体
func (req *GroupCreateRequest) ToModel() *model.Group {
	return &model.Group{
		GroupId:        req.GroupId,
		CreatorUid:     req.CreatorUid,
		GroupName:      req.GroupName,
		GroupAvatar:    req.GroupAvatar,
		GroupIntroduce: req.GroupIntroduce,
		GroupStatus:    req.GroupStatus,
	}
}
